using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using TMPro;

public class SecondaryTrigger : MonoBehaviour
{
    
    private PointTrigger pointTrigger;
    public ScoreManager ScoreManager;
    public AudioClip[] sounds;

    private AudioSource audioSource;
    void Start() 
    {
        pointTrigger = GetComponentInParent<PointTrigger>();
        audioSource = GetComponent<AudioSource>();
    } 
    void OnTriggerEnter2D(Collider2D other)
    {
//        print(other.gameObject.tag);
        String tag = other.gameObject.tag;
//        print("has get the tag");
        if (tag == "Player" && pointTrigger.IsTriggered)
        {
//            print("Yes");
            ScoreManager.AddScore();
            pointTrigger.basket.RandomPos(); 
            pointTrigger.basket2.RandomPos(); 
            audioSource.PlayOneShot(sounds[UnityEngine.Random.Range(0, sounds.Length)]);
            if (GameMod.GameMode == 0)
            {
                TimeManager.curTime = 0;
                TimeManager.isGameOver = false;
            }
        }
    }

    

}